#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

int gcd(int a, int b)
{
  assert(a > 0 && b > 0);
  while(b != 0){
    if(a>b)
      a -= b;
    else
      b -= a;
  }
  assert(b == 0);
  return a;
}

int main(int argc, char *argv[])
{
  int a,b,g,lcm;
  if(argc != 3){
    puts("usage: gcd  36 27");
    exit(1);
  }
  a = atoi(argv[1]);
  b = atoi(argv[2]);
  g = gcd(a,b);
  lcm = a*b/g;
  printf("the greatest common divisor is %d\n",g);
  printf("the least common multiple is %d\n",lcm);

  return 0;
}
